package com.example.demo.controller.report;

import com.example.demo.service.report.ReportService;
import com.example.demo.vo.remark.RemarkVO;
import com.example.demo.vo.report.ReportInfoVO;
import com.example.demo.vo.report.ReportVO;
import com.example.demo.vo.ResultVO;
import com.example.demo.vo.report.SimilarReportVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/report")
public class ReportController {
    @Resource
    ReportService reportService;


    @GetMapping("/getMyRid")
    public ResultVO<Integer> getMyRid(@RequestParam int tid){
        return reportService.getMyRid(tid);
    }

    @GetMapping("/getReportByRid")
    public ResultVO<ReportVO> getReportByRid(@RequestParam int rid){
        return reportService.getReportByRid(rid);
    }

    @GetMapping("/getReportByTask")
    public ResultVO<List<ReportVO>> getReportByTask(@RequestParam("tid") int tid,@RequestParam("pageNum") int pageNum){
        return reportService.getReportByTask(tid,pageNum);
    }

    @GetMapping("/getReportByWorkerTask")
    public ResultVO<ReportVO> getReportByWorkerTask(@RequestParam("username") String username,@RequestParam("tid") int tid){
        return reportService.getReportByWorkerTask(username,tid);
    }

    @PostMapping("/uploadReport")
    public ResultVO<ReportInfoVO> uploadReport(@RequestBody ReportInfoVO reportInfoVO){
        return reportService.uploadReport(reportInfoVO);
    }

    @GetMapping("/getRemarkByRid")
    public ResultVO<List<RemarkVO>> getRemarkByRid(@RequestParam("rid") int rid,@RequestParam("pageNum") int pageNum){
        return reportService.getRemarkByRid(rid,pageNum);
    }

    @GetMapping("/getRemarkableReportListByTaskId")
    public ResultVO<List<ReportVO>> getRemarkableReportListByTaskId(@RequestParam("tid") int tid,@RequestParam("uid") int uid,@RequestParam("pageNum")int pageNum){
        return reportService.getRemarkableReportListByTaskId(tid,uid,pageNum);
    }

    @GetMapping("/getReportWithSimilarity")
    public ResultVO<List<SimilarReportVO>> getReportWithSimilarity(@RequestParam("tid") int tid, @RequestParam("uid") int uid){
        return reportService.getReportWithSimilarity(tid, uid);
    }

    @GetMapping("/getReportWithScore")
    public ResultVO<List<ReportVO>> getReportWithScore(@RequestParam("tid") int tid,@RequestParam("uid") int uid){
        return reportService.getReportWithScore(tid,uid);
    }

    //获取报告的相似报告
    @GetMapping("/getSimilarityReportListByRid")
    public ResultVO<List<ReportVO>> getSimilarityReportListByRid(@RequestParam("rid") int rid,@RequestParam("min") int min,@RequestParam("max") int max,
                                                                 @RequestParam("pageNum")int pageNum){
        return reportService.getSimilarityReportListByRid(rid,min,max,pageNum);
    }
}
